package com.ysy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum FollowCancelTypeEnum {

    FOLLOW(1,"Follow"),
    CANCEL(0,"Cancel");
    ;

    private Integer type;
    private String desc;

    private static Map<Integer, FollowCancelTypeEnum> cache;

    static {
        cache = Arrays.stream(FollowCancelTypeEnum.values()).collect(Collectors.toMap(FollowCancelTypeEnum::getType, Function.identity()));
    };

    public static FollowCancelTypeEnum get(Integer type) {
        return cache.get(type)==null?null:cache.get(type);
    }


}
